namespace OracleInternal.Network
{
	internal class MarkerPacket : Packet
	{
		internal const int NSPMKTD0 = 0;

		internal const int NSPMKTD1 = 1;

		internal static byte NIQBMARK = 1;

		internal static byte NIQRMARK = 2;

		internal static byte NIQIMARK = 3;

		internal bool m_isResetMarker;

		internal bool m_isBreakMarker;

		internal int m_markerData;

		internal MarkerPacket(SessionContext sessCtx, int markerType)
			: base(sessCtx)
		{
			CreateBuffer(TNSPacketOffsets.NSPMKDAT + 1, 12, 0, sessCtx);
			m_dataBuffer[TNSPacketOffsets.NSPHDTYP] = 12;
			m_dataBuffer[TNSPacketOffsets.NSPMKTYP] = 1;
			m_dataBuffer[TNSPacketOffsets.NSPMKDAT] = (byte)markerType;
		}

		internal MarkerPacket(Packet pkt)
			: base(pkt)
		{
			if (m_length != TNSPacketOffsets.NSPMKDAT + 1)
			{
				throw new NetworkException(12539);
			}
			switch (m_dataBuffer[TNSPacketOffsets.NSPMKTYP])
			{
			case 0:
				m_isBreakMarker = true;
				break;
			case 1:
				m_markerData = m_dataBuffer[TNSPacketOffsets.NSPMKDAT];
				if (m_markerData == NIQRMARK)
				{
					m_isResetMarker = true;
				}
				else
				{
					m_isBreakMarker = true;
				}
				break;
			default:
				throw new NetworkException(12592);
			}
		}
	}
}
